<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
       var obj = {
           name:"zs",
           age:12,
           dog:{
               name:"金毛"
           }
       } 
       var obj1 = {};
       function copy(o,o1) {
           for(var key in o) {
            o1[key] = o[key]
           }
       }
       copy(obj,obj1)
       obj.dog.name = "dahuang";
       obj1.age= 333
       console.log(obj) 
       console.log(obj1)  
    //    简单数据类型是格子独立拥有的,复杂的是一份
    //    无法对复杂数据类型进行深拷贝,对复杂数据类型实质一个引用,实际指向一块区域
    </script>
</body>
</html>